
import useDocumentTitle from '../hooks/useDocumentTitle';

import { Header } from '../components/Header/Header';
import { Footer } from '../components/Footer';

import { useParams } from 'react-router-dom';
import { Spin } from 'antd';
import useGetData from '@hooks/useGetData';
import { useEffect, useState } from 'react';
import { Container } from '@/components/Container';

export default function BrochurePage() {
  const { pageid } = useParams();
  const [Data, loading] = useGetData(`/api/school/get_brochure_content/${pageid}`);
  const [brochureData, setBrochureData] = useState({});
  useEffect(() => {
    if (Data.length !== 0) {
      setBrochureData(Data[0]['SchoolBrochure'])
    }
  }, [Data])
  useDocumentTitle(`${brochureData.title || "招生章程"}-高考志愿填报系统`);
  return (
    <>
      <Header />
      <div className='brochure bg-[#f8f8f8] p-10'>
        <Spin spinning={loading}>
          <Container className='bg-white max-w-5xl'>
            <h2 className='text-3xl font-semibold mb-2 text-center pt-20'>{brochureData.title}</h2>
            <div className='text-sm mt-5 bg-gray-100 p-2 px-10 text-center'> 日期：{brochureData.create_date}</div>
            <div className='py-10 px-20'>
              <div dangerouslySetInnerHTML={{ __html: brochureData.content }} />
            </div>
          </Container>
        </Spin>
      </div>
      <Footer />
    </>
  );
}



